﻿/*
======================================================================================
CreatedTime:2011-10-28
Description:三层架构业务逻辑层父类
======================================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;
using System.Data.SqlClient;
using DAL;
using Models;
namespace BLL
{
	/// <summary>
	/// 业务逻辑类Tb_comment 的摘要说明。
	/// </summary>
	public class Tb_commentManagerBase
    {
	    protected readonly DAL.Tb_commentServiceBase dal = new DAL.Tb_commentServiceBase();
		
		#region 构造方法
		/// <summary>
		/// 业务逻辑类Tb_comment 的构造方法。
		/// </summary>
        /// <returns></returns>
		public Tb_commentManagerBase()
        { }
		#endregion
		
		#region  成员方法
		#region 是否存在该记录
        /// <summary>
        /// Tb_comment表是否存在该记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns>bool</returns>
        public bool ExistsTb_comment(int id)
        {
            return dal.ExistsTb_comment(id);
        }
		#endregion
		#region 增加一条数据
		/// <summary>
		/// Tb_comment表增加一条数据
		/// </summary>
		/// <param name="tb_comment">对象</param>
        /// <returns>row</returns>	
		public int AddTb_comment(Tb_comment tb_comment)
		{
			return dal.AddTb_comment(tb_comment);
		}
		#endregion
		#region 更新一条数据
		/// <summary>
		/// Tb_comment表更新一条数据
		/// </summary>
		/// <param name="tb_comment">对象</param>
        /// <returns>row</returns>
		public int ModifyTb_comment(Tb_comment tb_comment)
		{
			return dal.ModifyTb_comment(tb_comment);
		}
		#endregion
	    #region 删除一条数据
		/// <summary>
		/// 根据Tb_comment表主键ID删除一条数据
		/// </summary>
		/// <param name="id"></param>
        /// <returns>row</returns>
		public int DeleteTb_commentById(int id)
		{
			return dal.DeleteTb_commentById(id);
		}
		#endregion
		#region 得到一个对象实体
		/// <summary>
		/// Tb_comment表通过id得到一个对象实体
		/// </summary>
		/// <param name="id"></param>
        /// <returns>Tb_comment</returns>
		public Tb_comment GetTb_commentById(int id)
		{
			return dal.GetTb_commentById(id);
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_comment表得到一个泛型实体对象
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_comment> GetAllListFromTb_comments()
		{
			return dal.GetAllTb_comments();
		}
		#endregion
		#region 得到一个对象实体,返回List泛型集合
		/// <summary>
		/// Tb_comment通过id得到实体对象,返回List泛型集合
		/// </summary>
        /// <returns>IList</returns>
		public IList<Tb_comment> GetListFromTb_commentById(int id)
		{
		string sql =@"Select * From Tb_comment 
                    Where id=@id";
			try
			{
				SqlParameter[] para = new SqlParameter[]
				{
                 new SqlParameter("@id",id)
				};
				return dal.GetTb_commentsBySql(sql,para);
			}
			catch (Exception e)
			{
				throw e;
			}
		}					
		#endregion
		#region
		/// <summary>
		/// Tb_comment表通过sql语句的条件（“where”已经写上）得到一个实体对象（泛型集合）
		/// </summary>
		/// <param name="strWhere">strWhere</param>
        /// <returns>IList</returns>
		public IList<Tb_comment> GetTb_commentsByStrWhere(string strWhere)
		{
		    return dal.GetTb_commentsByStrWhere(strWhere);
		}
		#endregion
		#region 获得数据列表
		/// <summary>
        /// Tb_comment表根据条件字符串strWhere获得数据列表
        /// </summary>
		/// <param name="StrWhere">条件字符串</param>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_comment(string strWhere)
        {
            return dal.GetDataSetFromTb_comment(strWhere);
        }
		#endregion
		#region 获得全部数据列表
		/// <summary>
        /// Tb_comment获得数据列表
        /// </summary>
        /// <returns>DataSet</returns>
        public DataSet GetDataSetFromTb_comment()
        {
            return dal.GetDataSetFromTb_comment("");
        }
		#endregion
		#region 接收条件和参数Hashtable，返回DataTable
		/// <summary>
		/// Tb_comment表接收条件和参数Hashtable，返回DataTable
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>DataTable</returns>
		public DataTable GetDataTableFromTb_comment(string strWhere,Hashtable table)
		{
			return dal.GetDataTableFromTb_comment(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回List泛型集合
		/// <summary>
		/// Tb_comment表接收条件和参数Hashtable，返回List泛型集合
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>IList</returns>
		public IList<Tb_comment> GetListFromTb_comment(string strWhere,Hashtable table)
		{
			return dal.GetListFromTb_comment(strWhere,table);
		}
		#endregion
		#region 接收条件和参数Hashtable，返回一个实体类对象
		/// <summary>
		/// Tb_comment表接收条件和参数Hashtable，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_comment对象</returns>
		public Tb_comment GetModelTb_commentByWhere(string strWhere, Hashtable table)
		{
			return dal.GetModelFromTb_commentByWhere(strWhere, table);
		}
		#endregion
			#region 接收条件，返回一个实体类对象
		/// <summary>
		/// Tb_comment表接收条件，返回一个实体类对象
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>Tb_comment对象</returns>
		public Tb_comment GetModelTb_commentByWhere(string strWhere)
		{
			return dal.GetModelFromTb_commentByWhere(strWhere);
		}
		#endregion
		#region 接收条件和参数Hashtable，删除符合条件的记录
		/// <summary>
		/// Tb_comment表接收条件和参数Hashtable，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_commentByWhere(string strWhere, Hashtable table)
		{
			return dal.DeleteTb_commentByWhere(strWhere, table);
		}
			/// <summary>
		/// Tb_comment表接收条件和参数，删除符合条件的记录
		/// </summary>
		/// <param name="StrWhere"></param>
		/// <param name="table"></param>
        /// <returns>row</returns>
		public int DeleteTb_commentByWhere(string strWhere)
		{
			return dal.DeleteTb_commentByWhere(strWhere);
		}
		#endregion
		#endregion
	}
}
